package com.hanrui.android.library.widget;


import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hanrui.android.R;


/**
 * 
 * @author wg
 *
 */
public class LoadingDialog extends Dialog {
	private TextView dialogTv;
	String string = "";

	public LoadingDialog(Context context, String string) {
		super(context, R.style.loadingDialogStyle);
		this.string = string;
		this.setCanceledOnTouchOutside(true);
	}

	private LoadingDialog(Context context, int theme) {
		super(context, theme);
		this.setCanceledOnTouchOutside(true);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.item_loadingdialog);
		dialogTv = (TextView) this.findViewById(R.id.loadingdialog_tv);
//		dialogTv.setVisibility(View.GONE);
		if(string.equals("") || string == null)
		{
			dialogTv.setText("正在获取页面信息...");
		}else {
			dialogTv.setText(string);
		}
		RelativeLayout relativeLayout = (RelativeLayout) this.findViewById(R.id.relativeLayout);
		relativeLayout.getBackground().setAlpha(210);
	}
}
